package main

import (
	"amazegame/schema"
	"fmt"
	"os"
	"os/signal"
)

type Anlaofenpeijiangchi struct {
	Id        int
	SSSreward string
	SSreward  string
	Sreward   string
	Areward   string
	Breward   string
}

type Passlevelreward struct {
	Id                  int             `json:"id"`
	Baodisuipiandengji  [][]interface{} `json:"baodisuipiandengji"`
	Baodisuipiannum     [][]interface{} `json:"baodisuipiannum"`
	Shuchujianglizhanbi [][]interface{} `json:"shuchujianglizhanbi"`
	Dajiang             []interface{}   `json:"dajiang"`
	PrizeLevel_Ratio    int             `json:"PrizeLevel_Ratio"`
	PrizeLevel_ID       int             `json:"PrizeLevel_ID"`
	PrizeLevel_Duration int             `json:"PrizeLevel_Duration"`
	Flag                bool            `json:"flag"`
	Test                []interface{}   `json:"test"`
}

func main() {
	hotTable, err := schema.NewHotTable("schema/data/excel", true, "", "", "")
	if err != nil {
		return
	}
	var sheet *schema.MetaSheet
	sheet = hotTable.GetSheet("anlaofenpeijiangchi")
	if sheet != nil {
		keys, _ := sheet.GetRowKeys()
		for i := 0; i < len(keys); i++ {
			var item Anlaofenpeijiangchi
			err = sheet.GetRowObject(keys[i], &item)
			if err == nil {
				fmt.Println("key:", keys[i], "value:", item)
			}
		}
	}
	sheet = hotTable.GetSheet("passlevelreward")
	if sheet != nil {
		keys, _ := sheet.GetRowKeys()
		for i := 0; i < len(keys); i++ {
			var item Passlevelreward
			err = sheet.GetRowObject(keys[i], &item)
			if err == nil {
				fmt.Println("key:", keys[i], "value:", item)
			}
		}
		fields, _ := sheet.GetFields()
		for j := 0; j < len(fields); j++ {
			fmt.Println("fields:", j, "name:", fields[j])
		}
		comments, _ := sheet.GetComments()
		for j := 0; j < len(comments); j++ {
			fmt.Println("comments:", j, "name:", comments[j])
		}
	}
	fmt.Println("打印完成：Ctrl+C 退出")
	sigChan := make(chan os.Signal)

	signal.Notify(sigChan)

	select {
	case sig := <-sigChan:
		fmt.Println("接受到来自系统的信号：", sig)
	}
}
